package org.corespring.restaurant.web.controller;

import java.util.List;
import org.corespring.restaurant.service.PerfilManager;
import org.corespring.restaurant.model.Perfil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class PerfilController {

    private PerfilManager perfilManager;

    @Autowired
    public PerfilController(PerfilManager perfilManager) {
        this.perfilManager = perfilManager;
    }

    @RequestMapping("/adm_perfiles.htm")
    public void adm_perfiles(Model model, @ModelAttribute("perfil") Perfil perfil) {
        List<Perfil> perfiles = perfilManager.obtenerListaPerfiles();
        model.addAttribute("perfiles", perfiles);
        model.addAttribute("perfil", perfil);
    }

}
